module output use common_module contains subroutine save(flag) implicit none integer flag character(8) number character(100) filename character(7) kazu character(8) :: format0='e30.16e4' character(20) format1 integer,dimension(2) :: xro,yro,zro ! xro=xr+(/-1,1/)*(1-0**(xbox-1)) ! yro=yr+(/-1,1/)*(1-0**(ybox-1)) ! zro=zr+(/-1,1/)*(1-0**(zbox-1)) xro=xr*(1-udim(1))+(/1,xlen/)*udim(1) yro=yr*(1-udim(2))+(/1,ylen/)*udim(2) zro=zr*(1-udim(3))+(/1,zlen/)*udim(3) write (number,'(i07.7)') n number='_'//number select case (flag) case(1) filename=outdir//"boxsize.dat" open(1,file=filename,status='replace') write (1,'("xbox, ",i10)') xbox write (1,'("ybox, ",i10)') ybox write (1,'("zbox, ",i10)') zbox write (1,'("xmar, ",i10,",",i10)') xmar write (1,'("ymar, ",i10,",",i10)') ymar write (1,'("zmar, ",i10,",",i10)') zmar write (1,'("tlen, ",i10)') tlen write (1,'("gamma, ",d17.10)') gamma write (1,'("scL, ",d17.10)') scL write (1,'("scV, ",d17.10)') scV write (1,'("scRho, ",d17.10)') scRho write (1,'("scTmp, ",d17.10)') scTmp write (1,'("scPre, ",d17.10)') scPre write (1,'("scMag, ",d17.10)') scMag close (1) open(1,file=outdir//"xax.dat",status='replace',form='unformatted') write(1) xax(xro(1):xro(2)) close(1) open(1,file=outdir//"yax.dat",status='replace',form='unformatted') write(1) yax(yro(1):yro(2)) close(1) open(1,file=outdir//"zax.dat",status='replace',form='unformatted') write(1) zax(zro(1):zro(2)) close(1) if (size(cax1)+size(cax2)+size(cax3) .gt. 3) then open(1,file=outdir//"cax1.dat",status='replace',form='unformatted') write(1) cax1(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2)) close(1) open(1,file=outdir//"cax2.dat",status='replace',form='unformatted') write(1) cax2(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2)) close(1) open(1,file=outdir//"cax3.dat",status='replace',form='unformatted') write(1) cax3(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2)) close(1) open(1,file=outdir//"hx.dat",status='replace',form='unformatted') write(1) hx(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2)) close(1) open(1,file=outdir//"hy.dat",status='replace',form='unformatted') write(1) hy(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2)) close(1) open(1,file=outdir//"hz.dat",status='replace',form='unformatted') write(1) hz(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2)) close(1) end if case(2) open(1,file=outdir//"rho/"//"rho"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Sax(1)) close(1) open(1,file=outdir//"mom_x/"//"mom_x"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Vax(1)) close(1) open(1,file=outdir//"mom_y/"//"mom_y"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Vax(2)) close(1) open(1,file=outdir//"mom_z/"//"mom_z"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Vax(3)) close(1) open(1,file=outdir//"mag_x/"//"mag_x"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Bax(1)) close(1) open(1,file=outdir//"mag_y/"//"mag_y"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Bax(2)) close(1) open(1,file=outdir//"mag_z/"//"mag_z"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Bax(3)) close(1) open(1,file=outdir//"ene/"//"ene"//number//".dat",& status='replace',form='unformatted') write (1) U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),Sax(2)) close(1) filename=outdir//"tax.dat" format1='('//format0//')' if (n .eq. 0) then open(1,file=filename,status='replace') write(1,format1) tax(mod(n,taxlen)+1) close(1) else open(1,file=filename,position='append',status='old') write(1,format1) tax(mod(n,taxlen)+1) close(1) end if if (count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),:)))>1) then print*,'% Nan is detected. @ output.f90',n print*,1,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),1))) print*,2,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),2))) print*,3,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),3))) print*,4,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),4))) print*,5,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),5))) print*,6,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),6))) print*,7,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),7))) print*,8,count(isnan(U(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),8))) call time_print stop end if case(3) if (initial_flux_cancel .ge. 1) then open(1,file=outdir//"initial_flux.dat",& status='replace',form='unformatted') write (1) initial_flux(xro(1):xro(2),yro(1):yro(2),zro(1):zro(2),:) close(1) end if end select end subroutine save end module output